I have built a basic DB with a list and a radioBox with 2 options. I want to populate the list based on which selection has been made. The list is populating just fine, but I having issues with the "delete" function..it seems to only delete 1 or 2 of the current population before repopulating the list. any ideas?
DB box = create("box", styleStandard|styleCentered)
string choices[] = {}
string selChoices[] = {"choice one", "choice two"}
DBE choiceList =list(box, "", 10, 10, choices)
DBE radioSel = radioBox(box, "options", selChoices, 0)
int listVol = 0
void listOptions1(){
Module m = read("modname", false)
AttrType at = find(m, "enum")
int j
for (j = 0; j < listVol; j++){
delete(choiceList, j)
}
listVol = 0
int i
for (i = 0; i < listVol; i++){
insert(choiceList, i, at.strings[i])
listVol++
}
close(m, false)
}
void listOptions2(){
Module m = read("modulename", false)
Object obj
int i
for (i = 0; i < listVol; i++){
delete(choiceList, i)
}
listVol = 0
int j = 0
for obj in m do {
if (obj."Object Text""" != ""){
insert(choiceList, j, obj."Object Text""")
j++
listVol++
}
}
close(m, false)
}
void getChoice(DBE placeHolder){
int x = get(radioSel)
if (x == 0){
listOptions1()
} else if (x == 1){
listOptions2()
}
}
set(radioSel, getChoice)
realize(box)
listOptions1()
show(box)
SystemAdmin - Thu Jun 30 12:23:37 EDT 2011 |
Re: Issue with list DBE You need two global 'int' variables to house the length of your lists, perhaps listVol1 and listVol2.
|
Re: Issue with list DBE By the way: There is an "empty" function that will nicely empty listviews I think ... Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Issue with list DBE Mathias Mamsch - Thu Jun 30 13:24:38 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS @Mathias: That did the trick. Thanks for the help guys! -Adam |